#include <stdio.h>

/* Hash table data structure. */
template <class Key, class Hash, unsigned MaxItems, unsigned NumBuckets>
class HashSet
{
    struct Node
    { 
        Key key;                /* key of the item */
        unsigned next;          /* index to next node + 1 */
    } items[MaxItems];          /* array of nodes */
    unsigned num_items;         /* number of nodes */
    unsigned head[NumBuckets];  /* index to first node + 1 */
    const Hash hash;            /* hash function object */

public:
    HashSet() : num_items(0), head() { }

    // Clears the contents of a hash set.
    void clear()
    {
        for (unsigned i = 0; i < NumBuckets; i++)
            head[i] = 0;
        num_items = 0; 
    } 

    // Returns the number of elements in a hash set.
    size_t size() const { return num_items; }

    // Gets the item key at a given index (1-based).
    const Key &get(unsigned index) { return items[index-1].key; }

    // Tests whether a given key exists in the hash set. If the key is found, 
    // returns its one-based index; if the key is not found, returns 0.
    unsigned find(const Key &key) const
    {
        unsigned bucket = hash(key) % NumBuckets;
        unsigned k;
        for (k = head[bucket]; 
             k != 0 && !(items[k-1].key == key);
             k = items[k-1].next);
        return k;
    }

    // Adds an element into a hash set. Returns the one-based index to the
    // added element (or an existing item if the key already exists).
    unsigned add(const Key &key)
    {
        unsigned k = find(key);
        if (k == 0)
        {
            unsigned bucket = hash(key) % NumBuckets;
            k = ++num_items;
            items[k-1].key = key;
            items[k-1].next = head[bucket];
            head[bucket] = k;
        } 
        return k;
    }
};

struct Point 
{
    short x, y; 
    Point() { }
    Point(short _x, short _y) : x(_x), y(_y) { }
    bool operator == (const Point &other) const 
    {
        return x == other.x && y == other.y;
    }
};

struct PointHasher
{
    unsigned operator () (const Point &p) const
    {
        unsigned short x = p.x, y = p.y;
        return ((unsigned int)(x) << 16) | (unsigned int)(y);
    }
};

static HashSet<Point, PointHasher, 1000, 2003> points;

int main()
{
    int num_points;
    while (scanf("%d", &num_points) == 1 && num_points > 0)
    {
        int i, j, count = 0;
        for (i = 0; i < num_points; i++)
        {
            int x, y;
            scanf("%d %d", &x, &y);

            /* Check if this point and each existing point can form the 
             * diagonal of a square. */
            int x1 = x, y1 = y;
            for (j = 0; j < i; j++)
            {
                int x2 = points.get(j+1).x;
                int y2 = points.get(j+1).y;
                if ((x1 + x2 + y1 + y2) % 2 == 0)
                {
                    int x3 = ((x1+x2)-(y1-y2))/2;
                    int y3 = ((y1+y2)-(x2-x1))/2;
                    int x4 = ((x1+x2)+(y1-y2))/2;
                    int y4 = ((y1+y2)+(x2-x1))/2;
                    if (points.find(Point(x3, y3)) &&
                        points.find(Point(x4, y4)))
                        ++count;
                }
            }
            points.add(Point(x1, y1));
        }
        printf("%d\n", count);
        points.clear();
    }
    return 0;
}